home *** CD-ROM | disk | FTP | other *** search
- \ Virtual terminal program.
- \ Edit line-modes to reflect your serial line configuration.
- \
- \ line-modes initializes the serial line.
- \ connect go into virtual terminal mode.
- \
- \ Type ~. to get back to Forth.
-
- needs task: tasking.fth
- needs m-key modem.fth
-
- ascii ~ constant escchar
- ascii . constant endchar
-
- : m-key-pause ( -- char )
- begin pause m-key? until
- m-key
- ;
- : key-pause ( -- char )
- begin pause key? until
- key
- ;
-
- \ Listen to the keyboard and send the characters to the modem
- : >modem ( -- )
- begin
- key-pause
- dup escchar =
- if key-pause
- dup endchar =
- if true
- else dup escchar <> \ don't double ecsapes
- if escchar m-emit then
- m-emit false
- then
- else m-emit false
- then
- until
- ;
-
- \ Listen to the modem and send the characters to the display
- : modem> ( -- )
- begin m-key-pause emit again
- ;
-
- task: m>-task
- ' modem> m>-task fork
-
- : line-modes ( -- )
- 9600-baud 1-stop-bit 8-bits no-parity use-xon/xoff set-line
- ;
- : connect ( -- )
- cursor-on m>-task wake >modem m>-task sleep
- ;
-